package com.work03;

public class Ticket implements Runnable{
   private int count=100;
   private Object obj = new Object();
    @Override
    public void run() {

        while (true){
            synchronized (obj){
                if (count==0){
                    return;
                }else {
                    count--;
                    System.out.println(Thread.currentThread().getName()+":"+count);
                }
            }

        }
    }
}
